package com.chinaoryx.web;

import java.io.IOException;
import java.io.Writer;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import nl.justobjects.pushlet.core.Dispatcher;
import nl.justobjects.pushlet.core.Event;



public class TestServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		Writer out = resp.getWriter();
		out.write("message sent!");
		Event anEvent = null;		
		anEvent = Event.createDataEvent("/chat");
		anEvent.setField("msg", "servlet sended!");		
		Dispatcher.getInstance().broadcast(anEvent);
		out.flush();
	}

}
